Skip to content

Comments

feat(toolbar): add ais.index block support for index-scoped widgets#26

Open
sarahdayan wants to merge 4 commits intofeat/ais-index-block-supportfrom
feat/ais-index-toolbar
Open

feat(toolbar): add ais.index block support for index-scoped widgets#26
sarahdayan wants to merge 4 commits intofeat/ais-index-block-supportfrom
feat/ais-index-toolbar

Conversation

@sarahdayan
Copy link
Member

@sarahdayan sarahdayan commented Feb 21, 2026

Summary

Adds full toolbar support for ais.index blocks introduced in #25. Users can manage index-scoped widget hierarchies through both the manual UI and the AI assistant.

Key changes:

  • Auto-wrapping: index-dependent widgets are automatically placed inside ais.index blocks (creates one if none exists, appends to the last one otherwise)
  • Path-based addressing: all state callbacks use BlockPath ([parentIdx, childIdx]) instead of flat indices
  • New IndexBlockGroup component: grouped container showing index params + nested child widgets + scoped "Add Widget" button
  • Move between indices: child widgets can be moved between index blocks via a <select> dropdown
  • AI tools updated: path-based addressing, target_index validation, move_widget tool, parsePath hardening (rejects empty strings, negative indices, 3+ levels)
  • AddBlockResult return type: onAddBlock returns { path, indexCreated } so the AI tool can prompt for index name without relying on stale React state

Note

No new widget was added (aside from index). The preview images below used a dummy searchBox widget for manual tests, but this PR doesn't include it.

Files changed

File What
types.ts BlockPath, AddBlockResult, optional container, indexId
widget-types.tsx ais.index entry, indexIndependent flag, columns option
app.tsx Auto-wrap logic, path-based callbacks, onMoveBlock, helpers
panel.tsx Nested rendering, widget count, expand/collapse state machine
index-block-group.tsx New — grouped container for index blocks
block-card.tsx Index selector for moving widgets, label accessibility fix
block-editor.tsx CSS grid layout via columns config
add-widget-popover.tsx filter prop to exclude ais.index in scoped menus
ai/tools.ts Path addressing, target_index validation, move_widget, parsePath hardening
ai/system-prompt.ts Conciseness guidance
ai-chat.tsx Updated prop types
ai-tools.test.ts 11 new tests (44 → 55)

Preview

Capture d’écran 2026-02-21 à 11 21 52 Capture d’écran 2026-02-21 à 11 22 26

@sarahdayan sarahdayan changed the title feat(toolbar): add ais.index block support for index-scoped widgets feat(toolbar): add ais.index block support for index-scoped widgets Feb 21, 2026
@sarahdayan sarahdayan added the Priority PR PRs that should be reviewed early because other work depends on them label Feb 21, 2026
@sarahdayan sarahdayan force-pushed the feat/ais-index-block-support branch from 6f94e8d to 2e4cd56 Compare February 21, 2026 12:19
@sarahdayan sarahdayan force-pushed the feat/ais-index-toolbar branch 2 times, most recently from 82f34f0 to 8a3e775 Compare February 21, 2026 13:02
@sarahdayan sarahdayan force-pushed the feat/ais-index-block-support branch from 2e4cd56 to d12d03c Compare February 21, 2026 14:21
@sarahdayan sarahdayan force-pushed the feat/ais-index-toolbar branch from 8a3e775 to db9e620 Compare February 21, 2026 14:34
@sarahdayan sarahdayan force-pushed the feat/ais-index-block-support branch from d12d03c to ac3a2eb Compare February 21, 2026 15:49
sarahdayan and others added 4 commits February 21, 2026 17:13
Add nested block UI, auto-wrapping logic, move-between-indices support,
and AI tool updates for the new `ais.index` block type.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…fix stale closure

- Render `icon` as JSX element (`{icon}`) instead of component (`<Icon />`)
- Pass `blocks` as parameter to `updateCssVariablesOnPage` to avoid stale
  closure over `experience` state

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add tests for edge cases discovered during audit:
- describeExperience: empty index blocks, unnamed index blocks
- add_widget: container-in-parameters fallback, ais.index without params,
  ais.index doesn't require container
- remove_widget: malformed path rejection
- move_widget: non-existent nested path rejection

Also fix Prettier formatting in toolbar.css.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sarahdayan sarahdayan force-pushed the feat/ais-index-toolbar branch from db9e620 to 1f687c0 Compare February 21, 2026 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority PR PRs that should be reviewed early because other work depends on them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant